package com.atguigu.juc.completableFuture;

import java.util.concurrent.*;

/**
 * @author yfstart
 * @create 2022-06-11 19:56
 */
public class CompletableFutureDemo {
  public static void main(String[] args) throws ExecutionException, InterruptedException {
    FutureTask<String> futureTask = new FutureTask<String>(new MyCallableThread());
    Thread t1 = new Thread(futureTask, "t1");
    t1.start();
    System.out.println(futureTask.get());
  }
}

class MyRunnableThread implements Runnable {
  @Override
  public void run() {}
}

class MyCallableThread implements Callable<String> {
  @Override
  public String call() throws Exception {
    System.out.println("------ come in call()");
    return "hello callable";
  }
}
